package com.rfid.acs;


import com.rfid.acs.bean.BookBean;
import com.rfid.acs.net.tcp.FiledId;

class SearchBookResponseBean extends AcsResponseBean {

    /**
     * 2位定长字段：表示图书状态，取值范围00-99
     * 00在编
     * 01在馆
     * 02借出
     * 03预约
     * 04丢失
     * 05剔除
     */
    private String status;

    /**
     * 图书ID
     */
    @FiledId(name = "AB")
    private String bookId;

    /**
     * 图书名字
     */
    @FiledId(name = "AJ")
    private String bookName;

    /**
     * 应还日期
     */
    @FiledId(name = "AH")
    private String dueDate;

    /**
     * 借出日期
     */
    @FiledId(name = "CM")
    private String borrowDate;

    /**
     * 图书状态
     */
    @FiledId(name = "RE")
    private String bookStatus;

    /**
     * 提示信息
     */
    @FiledId(name = "AF")
    private String hintMessage;


    public SearchBookResponseBean(String source) {
        super(source);
    }

    @Override
    protected int headerLength() {
        return 2 + 2 + 2 + 2 + 18;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getBookName() {
        return bookName;
    }

    public void setBookName(String bookName) {
        this.bookName = bookName;
    }

    public String getDueDate() {
        return dueDate;
    }

    public void setDueDate(String dueDate) {
        this.dueDate = dueDate;
    }

    public String getBorrowDate() {
        return borrowDate;
    }

    public void setBorrowDate(String borrowDate) {
        this.borrowDate = borrowDate;
    }

    public String getBookId() {
        return bookId;
    }

    public void setBookId(String bookId) {
        this.bookId = bookId;
    }

    public String getBookStatus() {
        return bookStatus;
    }

    public void setBookStatus(String bookStatus) {
        this.bookStatus = bookStatus;
    }

    public String getHintMessage() {
        return hintMessage;
    }

    public void setHintMessage(String hintMessage) {
        this.hintMessage = hintMessage;
    }

    public BookBean convertToBookBean() {
        BookBean result = new BookBean();

        result.setBookId(getBookId());
        result.setBookName(getBookName());
        result.setBookStatus(getBookStatus());
        result.setBorrowDate(getBorrowDate());
        result.setLimitDate(getDueDate());
        result.setSuccess(isSuccess());

        return result;
    }
}
